//
//  TGAPIRequest.m
//  TongGuanLease
//
//  Created by 张奇 on 2022/4/11.
//

#import "TGAPIRequest.h"

@implementation TGAPIRequest

/***测试接口*/
+(NSURLSessionDataTask *)GETTestRequestRentType:(NSString *)rentType success:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail {
    NSDictionary *parameters = @{@"rentType":R(rentType)};
    return [self GETWithURLString:@"rent/getEquipmentCategory" parameters:parameters success:success failure:fail];
}

/***登陆接口*/
+ (NSURLSessionDataTask *)POSTLoginName:(NSString *)name passWord:(NSString *)passWord success:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail {
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:R(name) forKey:@"username"];
    [parameters setValue:R(passWord) forKey:@"password"];
//    [parameters setValue:R([[NSUserDefaults standardUserDefaults] objectForKey:APNS_TOKEN]) forKey:@"devicetoken"];
    NSURLSessionDataTask *extractedExpr = [self POSTWithURLString:@"api/login" parameters:parameters success:success failure:fail];
    return  extractedExpr;
}


/**
 *  注册接口
 *  phone
 *  passWord
 *  code
 */
+(NSURLSessionDataTask *)POSTRegisterPhone:(NSString *)phone passWord:(NSString *)passWord authCode:(NSString *)code success:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail {
    NSDictionary *parameters = @{@"phone":R(phone),@"password":R(passWord),@"code":R(code)};
    return  [self POSTWithURLString:@"" parameters:parameters success:success failure:fail];
}

@end
